#include <assert.h>
#include <pthread.h>
#include <stdatomic.h>

atomic_int a = 0;
int b = 0;

void *func1() {
	a = 1;
	b = 1;
}

void *func2() {
	while (b == 0) continue;
    assert(a == 1);
}

int main() {
	pthread_t p1, p2;
	pthread_create(&p2, NULL, func1, NULL);
	pthread_create(&p1, NULL, func1, NULL);

	pthread_join(p1, NULL);
	pthread_join(p2, NULL);
	return 1;
}
